package com.day0928.task;

import java.util.Arrays;

public class MyArray {
   private Object[] objects = new Object[5];
   private int len = 0;
    public void add(Object obj){
            objects[len] = obj;
            len++;
            if (len >= objects.length){
                objects = Arrays.copyOf(objects,objects.length*3/2+1);
            }

    }
    public void remove(int index){
        for (int i = index; i < len; i++) {
            objects[i] = objects[i + 1];
        }
        len -- ;
    }
    public Object get(int index){
        return objects[index];
    }
    public int getLen(){
        return len;
    }
}
